package converter.util

import java.io.File;
import java.util.List;

import org.junit.Test;

import converter.util.EffectivePomProducer;
import converter.util.EnvRetriver;

class EffectivePomProducerTest {
	@Test
	void testGetEffectivePom() {
		List allSamplePoms = findAllPoms(new File("src/test/resources/sample-poms"))
		allSamplePoms.each{File pomFile ->
			println "File $pomFile"
			EffectivePomProducer util = new EffectivePomProducer()
			util.getEffectivePom(pomFile)
		}
	}

	@Test
	void testEffectivePomWithEnvDefined() {
		EnvRetriver er = new EnvRetriver()
		EffectivePomProducer util = new EffectivePomProducer(er.getEnvMap())
		util.getEffectivePom(new File(/C:\work\Dnbi\proj-fe\svn\RT110NA3\livexp-platform\livexp-core\livexp-core-tests\pom.xml/))
	}

	List findAllPoms(File dir) {
		List allPoms = []
		dir.eachFileRecurse { File file ->
				 allPoms << file
		}
		return allPoms
	}

}
